/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bamba7.util;

import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Manuja
 */
public class CustomFieldLabelResolver {
    
    private CustomFieldLabelResolver resolver;
    private Properties properties; 

    private CustomFieldLabelResolver() {
        try {
            properties.load(new FileInputStream("customFieldLabelBundle.properties"));
        } catch (IOException ex) {
            Logger.getLogger(CustomFieldLabelResolver.class.getName()).log(Level.SEVERE, "Can not locate customFieldLabelBundle.properties", ex);
        }
    }
    
    
    
    public CustomFieldLabelResolver getCustomFieldLabelResolver(){
        if(resolver != null){
            resolver = new CustomFieldLabelResolver();
        } 
        return resolver;
    }
    
    public String getLabel(String key){
        String value = null;
        try{
            value = properties.getProperty(key).toString();
        }catch (NullPointerException ex){
            Logger.getLogger(CustomFieldLabelResolver.class.getName()).log(Level.SEVERE, "Key "+key+", can not be found", ex);
        }
        return value;
    }
}

